<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      label-width="auto"
      class="ry_form">
      <el-form-item label="UID" prop="uid">
        <el-input
          v-model="queryParams.uid"
          placeholder="请输入uid"
          size="small"
          clearable>
        </el-input>
      </el-form-item>
      <el-form-item
        label="手机号"
        prop="userPhone">
        <el-input
          size="small"
          v-model.trim="queryParams.orderPhone"
          placeholder="请输入手机号"
          clearable />
      </el-form-item>
      <el-form-item label="评价时间" prop="Time">
        <el-date-picker
          v-model="queryParams.Time"
          type="datetimerange"
          :picker-options="pickerOptions"
          range-separator="至"
          size="small"
          format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
          align="right"
          @change="handleChange">
        </el-date-picker>
      </el-form-item>
      <el-form-item
        label="产品评分"
        prop="userPhone">
        <el-input-number
          size="small"
          v-model="queryParams.orderPhone"
          :min="1"
          :step="0.5"
          :max="5"
          clearable />
      </el-form-item>
      <el-form-item
        label="物流评分"
        prop="userPhone">
        <el-input-number
          size="small"
          v-model="queryParams.orderPhone"
          :min="1"
          :step="0.5"
          :max="5"
          clearable />
      </el-form-item>
      <el-form-item
        label="服务评分"
        prop="userPhone">
        <el-input-number
          size="small"
          v-model="queryParams.orderPhone"
          :min="1"
          :step="0.5"
          :max="5"
          clearable />
      </el-form-item>
      <el-form-item
        label="状态"
        prop="userPhone">
        <el-select v-model="queryParams.status" clearable size="small">
          <el-option
            v-for="item in typeOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item class="flex_one tr">
        <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">筛选</el-button>
        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      v-loading="loading"
      :data="list"
      cell-class-name="my-cell">
      <el-table-column label="序号" type="index" :index="index => index + 1" />
      <el-table-column prop="id" label="UID" />
      <el-table-column prop="uid" label="手机号" />
      <el-table-column prop="uid" label="手机号" />
      <el-table-column prop="uid" label="用户昵称" />
      <el-table-column prop="uid" label="类别" />
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            type="text"
            size="small">查看详情</el-button>
          <el-switch
            v-if="scope.row.status === 0"
            v-model="scope.row.status"
            active-text="开通权限"
            inactive-text="关闭权限" />
        </template>
      </el-table-column>
    </el-table>
    <InBody v-show="total>0">
      <pagination
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList" />
    </InBody>
    <el-dialog title="配置" :visible.sync="dialogVisible" width="600px" @click="handleClose">
      <el-card class="mt10">
        <el-descriptions
          title="基本信息"
          :column="4"
          :label-style="{ width: '100px' }"
          border>
          <!-- TODO -->
        </el-descriptions>
      </el-card>
<!--      <div slot="footer" class="dialog-footer"></div>-->
    </el-dialog>
  </div>
</template>

<script>
import dateUtil from "@/utils/DateUtil";

export default {
  name: "/distributor/auth",
  data() {
    return {
      // 遮罩层
      loading: false,
      // 时间配置
      pickerOptions: {
        shortcuts: dateUtil.getTimeShort2()
      },
      detail: {},
      dialogVisible: false,
      ids: [],
      total: 0,
      list: [],
      typeOptions: [
        { label: "达人", value: 0 },
        { label: "机构", value: 1 },
        { label: "个人", value: 2 }
      ],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        Time: [],
        startDateTime: '',
        endDateTime: ''
      }
    }
  },
  methods: {
    handleClose () {
      this.dialogVisible = false;
      this.detail = {}
    },
    // 时间搜索条件change方法
    handleChange(value) {
      if (!value) {
        this.queryParams.startDateTime = null;
        this.queryParams.endDateTime = null;
      }
    },
    // 重置表单
    resetForm(key) {
      Object.assign(this.$data[key], this.$options.data()[key]);
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    getList() {}
  }
}
</script>

<style scoped>

</style>
